package com.isoft.farm.controller;

import com.isoft.farm.common.JsonResult;
import com.isoft.farm.entity.SysMenu;
import com.isoft.farm.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/menu")
public class SysMenuController {
    @Autowired
    SysMenuService sysMenuService;
    @RequestMapping("/doFindObjects")
    public JsonResult doFindObjects(){
        return new JsonResult(sysMenuService.findObjects());
    }

    @RequestMapping("/doDeleteObjects")
    public JsonResult doDeleteObjects(Integer id){
        sysMenuService.deleteObject(id);
        return new JsonResult();
    }
    @RequestMapping("/doFindZtreeMenuNodes")
    public JsonResult doFindZtreeMenuNodes(){
        return new JsonResult(sysMenuService.findZtreeMenuNodes());
    }

    @RequestMapping("doSaveObject")
    public JsonResult doSaveObjecy(SysMenu sysMenu){
        sysMenuService.saveObject(sysMenu);
        return new JsonResult();
    }

    @RequestMapping("doUpdateObject")
    public JsonResult doUpdateObject(SysMenu sysMenu){
        sysMenuService.updateObject(sysMenu);
        return new JsonResult();
    }

}
